home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Acorn User: China
/
Acorn User China CD-ROM (UK) (Disc B)
/
Acorn User China CD-ROM (UK) (Disc B).bin
/
STUTTGART
/
LANG
/
GOFER
/
scripts_Grundy
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Text File
|
1993-03-08
|
213 b
|
11 lines
--- Grundy numbers
data Game = Moves [Game]
grundy :: Game -> Int
grundy (Moves gs) = least (\n -> and [n/=grundy g|g<-gs])
least p = x where x:_ = [ n | n <- [0 ..], p n ]
nim n = Moves [nim m|m<-[0..(n-1)]]